Usage Note 67567: A query that includes the UNION of two queries that reference a Google BigQuery table might result in a performance issue and error
When running a FEDSQL procedure query that includes the UNION of two queries that reference a Google BigQuery table, you might encounter a performance issue and error similar to the following:
ERROR: [42000] Error: googleapi: Error 400: Syntax error: Expected keyword ALL or keyword DISTINCT but got keyword SELECT at [1:136], invalidQuery
This issue occurs when the query does not include the ALL keyword. The Google BigQuery database requires either the ALL or DISTINCT keyword to be included with the UNION operator. When the ALL keyword is not present in the FEDSQL query, the query that is passed to the database does not include the DISTINCT keyword. As a result of the error, each of the two sub-queries is submitted separately. Then, the results of each is pulled into SAS®, which performs the UNION into a single result set.
Running the same query with the SQL procedure might result in the performance issue. Even though it appears that the query is being passed to the database, the same issue is also occurring. The error is just not surfaced to the log.
Operating System and Release Information
SAS System | SAS/ACCESS Interface to Google BigQuery | Linux for x64 | 9.41 | 9.43 | 9.4 TS1M6 | 9.4 TS1M8 |
SAS System | SAS/ACCESS Interface to Google BigQuery (on SAS Viya) | Linux for x64 | V.03.04 | 2020.1.2 | Viya | Viya |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Date Modified: | 2021-04-02 13:38:10 |
Date Created: | 2021-03-08 14:16:00 |